import Vue from 'vue'
import VueRouter from 'vue-router'
// 一级路由
import Layout from '@/views/layout.vue'
// 二级路由
import Article from '@/views/article.vue'
import Findroom from '@/views/findroom.vue'
import Info from '@/views/info.vue'
import User from '@/views/user.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: Layout,
    redirect: '/article',
    children: [
      { path: '/article', component: Article },
      { path: '/findroom', component: Findroom },
      { path: '/info', component: Info },
      { path: '/user', component: User }
    ]
  }

  // {
  //   path: '/about',
  //   name: 'about',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  // }
]

const router = new VueRouter({
  routes
})

export default router
